<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Directory 类</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="dir.constants.html">« 预定义常量</a></li>
      <li style="float: right;"><a href="directory.close.html">Directory::close »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.dir.html">目录</a></li>
    <li>Directory 类</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.directory" class="reference">

 <h1 class="title">Directory 类</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p>


  <div class="section" id="directory.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    <span class="classname"><strong class="classname">Directory</strong></span> 实例是通过调用
    <span class="function"><a href="function.dir.html" class="function">dir()</a></span> 函数创建的，而不是 <a href="language.oop5.basic.html#language.oop5.basic.new" class="link">new</a> 操作符。
   </p>
  </div>


  <div class="section" id="directory.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">Directory</strong>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 属性 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.directory.html#directory.props.path">$<var class="varname">path</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type">resource</span>
      <var class="varname"><a href="class.directory.html#directory.props.handle">$<var class="varname">handle</var></a></var>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="directory.close.html" class="methodname">close</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="directory.read.html" class="methodname">read</a></span>(): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="directory.rewind.html" class="methodname">rewind</a></span>(): <span class="type"><span class="type void">void</span></span></div>

   }</div>


  </div>


  <div class="section" id="directory.props">
   <h2 class="title">属性</h2>
   <dl>
    
     <dt id="directory.props.path"><var class="varname">path</var></dt>

     <dd>

      <p class="para">
       被打开目录的地址。
      </p>
     </dd>

    
    
     <dt id="directory.props.handle"><var class="varname">handle</var></dt>

     <dd>

      <p class="para">
       目录句柄。可以被其他的目录操作函数使用，例如
       <span class="function"><a href="function.readdir.html" class="function">readdir()</a></span>、<span class="function"><a href="function.rewinddir.html" class="function">rewinddir()</a></span>
       和 <span class="function"><a href="function.closedir.html" class="function">closedir()</a></span>。
      </p>
     </dd>

    
   </dl>

  </div>

  <div class="section">
   <h2 class="title">更新日志</h2>
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>8.1.0</td>
       <td>
        现在 <var class="varname">path</var> 和 <var class="varname">handle</var> 属性是只读的。
       </td>
      </tr>

     </tbody>
    
   </table>

  </div>


 </div>

 






















<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="directory.close.html">Directory::close</a> — 关闭目录句柄</li><li><a href="directory.read.html">Directory::read</a> — 从目录句柄中读取条目</li><li><a href="directory.rewind.html">Directory::rewind</a> — 倒回目录句柄</li></ul>
</div>
</div></div></body></html>